import {reqUserAddressList,reqTrade} from "@/api"
const actions = {
  //获取用户地址信息
  async getUserAddressList({commit}){
    const result = await reqUserAddressList()
    if(result.code == 200){
      commit("GETUSERADDRESSLIST",result.data)
    }
  },

  //获取用户订单交易页信息
  async getUserTrade({commit}){
    const result = await reqTrade()
    if(result.code == 200){
      commit("GETUSERTRADE",result.data)
    }
  }
} 
const mutations = {
  GETUSERADDRESSLIST(state,userAddress) {
      state.userAddress = userAddress
  },

  GETUSERTRADE(state,userTrade){
      state.userTrade = userTrade
  }
}
const state = {
  userAddress:[],
  userTrade:{}
}
const getters = {}

export default {
  namespaced:true,
  actions,
  mutations,
  state,
  getters
}